package com.app.teaware.bean;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

public class LocationListBean extends BaseListBean{
    private ArrayList<LocationListData> list = new ArrayList<LocationListData>();

    public ArrayList<LocationListData> getList() {
        return list;
    }

    public void setList(ArrayList<LocationListData> list) {
        this.list = list;
    }

    @JSONField(serialize = false)
    public void addListBean(LocationListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<LocationListData>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    //获得楼层
    public List<String> getAllLocationSna(){
        List<String> listUnit = new ArrayList<>();
        for (LocationListData location : list){
            listUnit.add(location.getSna());
        }
        return listUnit;
    }

    public String[] getAllLocation(){
        List<String> locationList = getAllLocationSna();
        if(locationList == null || locationList.size()== 0){
            return null;
        }
        String[] arr = locationList.toArray(new String[locationList.size()]);
        return arr;
    }
}
